﻿using System;
using System.Collections.Generic;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using HZ.Supervise.Model;
using HZ.Supervise.IBLL; 
using HZ.Supervise.Model.Enum;
using System.Data;

namespace HZ.Supervise.Web.SystemManage
{
    public partial class HospitalInfo : BasePage
    {
        public HospitalInfo()
        {
            this.ModuleNo = Module.基础信息库.ToString();
            PageOperateType = OperateType.医疗机构信息.ToString();
        }

        IBLL_PreWarning ip = HZ.Supervise.BLLFactory.IBLL_PreWarning();

        private string areaID = "";

        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {  
                GetInfo();
            }
        }

        /// <summary>
        /// 获取医院信息
        /// </summary>
        private void GetInfo()
        {
            if (!string.IsNullOrEmpty(Request.QueryString["hID"]))
            {
                int temp;
                string hID = Request.QueryString["hID"];

                IBLL_PreWarning ip = HZ.Supervise.BLLFactory.IBLL_PreWarning(); 
                HZ.Supervise.Model.Hospital mHospital = new HZ.Supervise.Model.Hospital();
                int t = 0;
                DataTable dt = ip.GetHospital(mHospital,1,0,out t);
                foreach (DataRow dr in dt.Rows)
                {
                    lblHospitalID.Text = dr["HospitalID"].ToString();  
                    lblHospitalName.Text = dr["HospitalName"].ToString(); 
                    lblHospitalAdress.Text = dr["HospitalAddress"].ToString();  
                    lblContactTel.Text = dr["ContactTel"].ToString(); 
                    lblContactPerson.Text = dr["ContactPerson"].ToString();
                    lblIsCountry.Text = dr["IsCountry"].ToString()=="0"?"非基层医疗机构":"基层医疗机构";
                    lblIsGov.Text = dr["IsCountry"].ToString() == "0" ? "非政府办医疗机构" : "政府办医疗机构";
                   
                    switch (dr["Levels"].ToString())
                    { 
                        case "0":
                            lblLevels.Text = "其他等级";
                            break;
                        case "1":
                            lblLevels.Text = "一级甲等";
                            break;
                        case "2":
                            lblLevels.Text = "一级乙等";
                            break;
                        case "3":
                            lblLevels.Text = "二级甲级";
                            break;
                        case "4":
                            lblLevels.Text = "二级乙级";
                            break;
                        case "5":
                            lblLevels.Text = "三级甲等";
                            break;
                        case "6":
                            lblLevels.Text = "三级乙等";
                            break;
                    }

                    switch (dr["IsCountryDetail"].ToString())
                    {
                         
                        case "1":
                            lblLevels.Text = "乡镇医疗机构";
                            break;
                        case "2":
                            lblLevels.Text = "社区医疗机构";
                            break;
                        case "3":
                            lblLevels.Text = "民营医疗机构";
                            break;
                        case "4":
                            lblLevels.Text = "其他医疗机构";
                            break;
                        
                    }
                    
                }
 
             
            }
        }

        protected void btnBack_Click(object sender, EventArgs e)
        {
            Response.Redirect("HospitalMange.aspx");
        }

         
    }
}
